home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / workbench / directoryopus4 / dopus4_src / config / paint_mode.c < prev    next >
C/C++ Source or Header  |  2000-03-11  |  3KB  |  121 lines

  1. /*
  2.  
  3. Directory Opus 4
  4. Original GPL release version 4.12
  5. Copyright 1993-2000 Jonathan Potter
  6.  
  7. This program is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU General Public License
  9. as published by the Free Software Foundation; either version 2
  10. of the License, or (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. All users of Directory Opus 4 (including versions distributed
  22. under the GPL) are entitled to upgrade to the latest version of
  23. Directory Opus version 5 at a reduced price. Please see
  24. http://www.gpsoft.com.au for more information.
  25.  
  26. The release of Directory Opus 4 under the GPL in NO WAY affects
  27. the existing commercial status of Directory Opus 5.
  28.  
  29. */
  30.  
  31. #include "config.h"
  32.  
  33. get_paint_colours(fg,bg,type)
  34. int *fg,*bg,type;
  35. {
  36.     struct DOpusListView dummylist;
  37.     struct Window *window;
  38.     struct IntuiMessage *msg;
  39.     ULONG class;
  40.     USHORT code;
  41.     int x,y,gadgetid;
  42.  
  43.     dummylist.w=330;
  44.     dummylist.h=37;
  45.  
  46.     listokaygad[1].NextGadget=NULL;
  47.  
  48.     setup_list_window(&requestwin,&dummylist,listokaygad,2);
  49.  
  50.     requestwin.Title=cfg_string[STR_PAINT_SELECT_COLOURS];
  51.     if (!(window=openwindow(&requestwin))) return(0);
  52.     AddGadgets(window,
  53.         listokaygad,
  54.         listviewgads,
  55.         2,
  56.         screen_pens[config->gadgettopcol].pen,screen_pens[config->gadgetbotcol].pen,1);
  57.     setupcolourbox(window->RPort,dummylist.x+7,dummylist.y+13,*fg,*bg);
  58.     showfuncob(window->RPort,cfg_string[STR_EXAMPLE],*fg,*bg,type,dummylist.x+101,dummylist.y+3);
  59.  
  60.     busy();
  61.  
  62.     FOREVER {
  63.         while (msg=(struct IntuiMessage *)GetMsg(window->UserPort)) {
  64.             class=msg->Class;
  65.             code=msg->Code;
  66.             x=msg->MouseX;
  67.             y=msg->MouseY;
  68.             if (class==IDCMP_GADGETUP)
  69.                 gadgetid=((struct Gadget *)msg->IAddress)->GadgetID;
  70.             ReplyMsg((struct Message *)msg);
  71.  
  72.             switch (class) {
  73.                 case IDCMP_MOUSEBUTTONS:    
  74.                     if (code==SELECTDOWN)
  75.                         docolourgad(window->RPort,
  76.                             dummylist.x+7,dummylist.y+13,
  77.                             x,y,
  78.                             cfg_string[STR_EXAMPLE],fg,bg,type);
  79.                     break;
  80.  
  81.                 case IDCMP_GADGETUP:
  82.                     CloseWindow(window);
  83.                     unbusy();
  84.                     return(gadgetid);
  85.             }
  86.         }
  87.         Wait(1<<window->UserPort->mp_SigBit);
  88.     }
  89. }
  90.  
  91. void do3dbox(x,y,w,h)
  92. int x,y,w,h;
  93. {
  94.     Do3DBox(rp,x,y,w,h,screen_pens[config->gadgettopcol].pen,screen_pens[config->gadgetbotcol].pen);
  95. }
  96.  
  97. void fix_slider(gad)
  98. struct Gadget *gad;
  99. {
  100.     gad->MutualExclude=screen_pens[0].pen;
  101.     ((struct Image *)gad->GadgetRender)->PlaneOnOff=screen_pens[1].pen;
  102. }
  103.  
  104. struct Window *openwindow(newwin)
  105. struct NewWindow *newwin;
  106. {
  107.     struct Window *win;
  108.  
  109.     if (win=OpenWindow(newwin)) {
  110.         if (tfont) SetFont(win->RPort,tfont);
  111.         SetAPen(win->RPort,screen_pens[0].pen);
  112.         RectFill(win->RPort,
  113.             win->BorderLeft,win->BorderTop,
  114.             win->Width-win->BorderRight-1,
  115.             win->Height-win->BorderBottom-1);
  116.         SetAPen(win->RPort,screen_pens[1].pen);
  117.         SetBPen(win->RPort,screen_pens[0].pen);
  118.     }
  119.     return(win);
  120. }
  121.